package com.zhutengwei.android.zuji.tool;

import android.content.ContentResolver;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.provider.MediaStore;

import java.io.File;
import java.io.IOException;

/**
 * Created by Administrator on 2017/3/3.
 */
public class FileUtil {
    public static Bitmap getImagFromPath(Context context, String pathname){
        //获得图片
        Bitmap bitmap = null;
        ContentResolver resolver = context.getContentResolver();
            Uri uri = Uri.fromFile(new File(pathname));
            try {
                bitmap = MediaStore.Images.Media.getBitmap(resolver,uri);//获得图片
            } catch (IOException e) {
                e.printStackTrace();
            }
        return bitmap;
    }
}
